<template>
  <div>
    <CategorySelector :isCheckInput="scene !== 1"></CategorySelector>

    <!-- 三个子组件 -->
    <el-card style="margin: 10px 0">
      <SpuList
        v-if="scene == 1"
        @changeScene="saveScene"
        @getSpuInfo="saveSpuInfo"
      ></SpuList>
      <SpuForm
        v-if="scene == 2"
        @changeScene="saveScene"
        :currentSpuInfo="currentSpuInfo"
      ></SpuForm>
      <SkuForm
        v-if="scene == 3"
        :currentSpuInfo="currentSpuInfo"
        @changeScene="saveScene"
      ></SkuForm>
    </el-card>
  </div>
</template>

<script lang="ts">
import CategorySelector from "@/components/CategorySelector"
import SpuList from "./components/SpuList.vue"
import SpuForm from "./components/SpuForm.vue"
import SkuForm from "./components/SkuForm.vue"
export default {
  name: "Spu",
  components: { CategorySelector, SpuList, SpuForm, SkuForm },
}
</script>

<script lang="ts" setup>
import { ref } from "vue"

const scene = ref<number>(1)
const currentSpuInfo = ref([])

const saveScene = (val: number) => {
  scene.value = val
}

const saveSpuInfo = row => {
  currentSpuInfo.value = row
}
</script>

<style></style>
